<!--
 * @Author: lxb lxb18228057066@qq.com
 * @Date: 2022-10-13 14:15:32
 * @LastEditors: lxb lxb18228057066@qq.com
 * @LastEditTime: 2022-10-24 09:53:18
 * @FilePath: \shinegis-client-23dg:\code\vue-cli3-template\src\components\Gundong.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="bff">
    <div class="box">
      <div 
        class="item"
        v-for="(item, itemIndex) in str.length"
        :key="itemIndex" 
      >
        <div class ="item_box" :style="'transform:translateY(' +  numArr[itemIndex] + '%)'">
          <div 
            v-for="(item, index) in 10"
            :key="index" 
          >
            {{index}}
          </div>
        </div>
      </div>
    </div>
  </div> 
</template>

<script>
export default {
  name: "Gundong",
  props: {
    num: {
      type: Number,
      default: 2952,
    },
  },
  computed: {
    str() {
      return this.num.toString();
    },
    numArr() {
      let result = [];
      for(let i = 0; i < this.str.length; i++){
        result.push(-Number(this.str[i]) * 10)
      }
      return result; // [-20, -90, -50, -20]
    }
  },
}
</script>

<style lang="scss" scoped>
.bff{
  width: 100%;
  height: 50px;
  width: 100%;
  background: #000;
  .box{
    display: flex;
    .item{
      width: 30px;
      height: 40px;
      border: 1px solid #fff;
      color: #ffff00;
      font-family: "LetsgoDigitalRegular";
      font-size: 40px;
      text-align: center;
      line-height: 40px;
      margin: 5px;
      overflow: hidden;
      .item_box{
        transition: all 1s;
      }
    }
  }
}
</style>